Stored Procedures [dbo].[BAEOrderProductGetCrossSellSelectedToDisplay]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@OrderProductIDint4
SQL Script
create procedure [dbo].[BAEOrderProductGetCrossSellSelectedToDisplay] @OrderProductID int as
SELECT op.OrderProductID, op.Title, op.[Description], op.IsSuperProduct, op.ProductCode, op.SellOnWeb
    FROM OrderProduct AS op INNER JOIN Product p ON p.PRODUCT_CODE COLLATE database_default = op.ProductCode COLLATE database_default
    WHERE op.IsSuperProduct = 0 AND op.OrderProductID <> @OrderProductID AND WEB_OPTION != 0 AND
        op.OrderProductID IN (SELECT CrossSellOrderProductID FROM OrderProductCrossSellLookup
                         WHERE OrderProductID = @OrderProductID)
    UNION
    SELECT op1.OrderProductID, op1.Title, op1.[Description], op1.IsSuperProduct, op1.ProductCode, op1.SellOnWeb FROM OrderProduct AS op1
    WHERE op1.IsSuperProduct = 1 AND op1.OrderProductID <> @OrderProductID AND op1.SellOnWeb != 0 AND
        op1.OrderProductID IN (SELECT CrossSellOrderProductID FROM OrderProductCrossSellLookup
                         WHERE OrderProductID = @OrderProductID)

GO
Uses